<?php 
//添加职工天地
require_once("../include/conn.php");
$nname=$_REQUEST["c_name"];


$title=$_REQUEST["title"];

$tdate=$_REQUEST["tdate"];
$content=$_REQUEST["content"];
$file = $_FILES["uploadfile"]["tmp_name"];
	
	
if($_REQUEST["action"] == "update")
{	

if(!empty($_REQUEST["id"]) and !empty($nname))
{

$id=$_REQUEST["id"];




	
switch ($nname){
case  "3":
$sql_dt="UPDATE `$tb_dt` SET `title` = '$title',`tdate` = '$tdate',`content` = '$content' WHERE `id` = '$id'";
//$sql_dt="UPDATE `bl_dtxx` SET `title` = '$title',`content` = '$content',`tdate` = '$tdate' WHERE `id` = '$id'";
$cn_dt = mysql_db_query($db_name,$sql_dt);

break;
case  "4":
$sql_rw="UPDATE `$tb_rw` SET `title` = '$title',`tdate` = '$tdate',`content` = '$content' WHERE `id` = '$id'";
$cn_rw = mysql_db_query($db_name,$sql_rw);

break;
case  "6":
$sql_dz="UPDATE `$tb_dz` SET `title` = '$title',`tdate` = '$tdate',`content` = '$content' WHERE `id` = '$id'";
$cn_dz = mysql_db_query($db_name,$sql_dz);


}

}

else{


?>
<meta http-equiv="refresh" content="0;URL=admin_index.php">
<?php }
}


if($_REQUEST["action"] == "add")
{	


switch ($nname){
case  "3":
$sql_add="INSERT INTO `$tb_dt` ( `id` , `title` , `author` , `content`, `tdate` ) VALUES (null, '$title', '综合管理部 ', '$content', '$tdate')";
break;
case  "4":
$sql_add="INSERT INTO `$tb_rw` ( `id` , `title` , `author` , `content`, `tdate` ) VALUES (null, '$title', '综合管理部 ', '$content', '$tdate')";

break;
case  "6":
$sql_add="INSERT INTO `$tb_dz` ( `id` , `title` , `author` , `content`, `tdate` ) VALUES (null, '$title', '综合管理部 ', '$content', '$tdate')";


}

$cn_add = mysql_query($sql_add);
$id = mysql_insert_id();

}

//echo $nname;	
?>
<script language="JavaScript" type="text/JavaScript">
alert("操作已成功!");
</script>

<?	

 
  echo "<script language='javascript'>";
if($nname==3){
echo "self.location="."'"."info_mange.php?name=3'";
}
else if($nname==4){

echo "self.location="."'"."info_mange.php?name=4'";
}
else if($nname==6){

echo "self.location="."'"."info_mange.php?name=6'";
}
echo "</script>";	  



?>


